<template>
  <div>
    <div class="title">热销推荐</div>
    <ul>
      <router-link
        class="item"
        v-for="item of list"
        :key="item.id"
        :to="'/detail/' + item.id"
      >
        <img class="item-img" :src="item.imgUrl" />
        <div class="item-info">
          <p class="item-title">{{item.title}}</p>
          <p class="item-desc">{{item.desc}}</p>
          <button class="item-button">查看详情</button>
        </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'HomeRecommend',
  props: {
    list: Array
  }
}
</script>

<style lang="stylus" scoped>
  @import '~styles/mixins.styl'
  @import '~styles/variables.styl'
  .title
    line-height 40px
    background-color #eee
    text-indent 2em
    color $darkTextColor
    font-weight bolder
  .item
    overflow hidden
    display flex
    height 94px
    border-bottom 1px solid #efefef
    .item-img
      width 94px
      height 94px
      padding 5px
    .item-info
      // flex 1会自动撑开屏幕的宽度
      flex 1
      padding 5px
      .item-title
        line-height 27px
        font-size 16px
        color $darkTextColor
        font-weight bolder
        ellipsis()
      .item-desc
        line-height 20px
        font-size 14px
        color #898989
        ellipsis()
      .item-button
        line-height 22px
        margin-top 10px
        background-color #ff9300
        padding 2px 5px
        font-size 12px
        border-radius 3px
        color #fff
</style>
